USE [influenza]
GO

/****** Object:  StoredProcedure [dbo].[SP_CambioSTAviso]    Script Date: 12/30/2009 20:41:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[SP_CambioSTAviso]
@id_aviso varchar(2),
@opcion varchar(10),
@status varchar(2)
as
Begin

declare @qry varchar(255)

if @opcion='activo'
  begin
	set @qry='update dat_avisos set '+@opcion+'='+@status+' Where id_aviso='+@id_aviso
  end
else if @opcion='listado'
  begin
	set @qry='update dat_avisos set '+@opcion+'='+@status+' Where id_aviso='+@id_aviso
  end

exec (@qry)
End

GO

